<?php


namespace App\Bizs\Mp1;


use App\Exceptions\BizException;
use Base\BaseBiz;
use Qiniu\Auth;

class QiniuBiz extends BaseBiz
{
    /**
     * 获取上传token
     * @param $params
     * @return string
     * @throws BizException
     * @throws \Base\BaseException
     */
    public function getToken($params)
    {
        var_dump($params);
        if (empty($params['bucket'])) {
            throw new BizException('请选择存储桶');
        }
        $auth = new Auth(config('env.QINIU_AK'), config('env.QINIU_SK'));
        return $auth->uploadToken($params['bucket']);
    }
}
